package kernel_gui.interfaces.kernel_gui;

import java.util.List;

import common.entities.enums.ACTION;
import common.entities.enums.ENTITIES;
import common.entities.persistent.Actor;
import common.entities.persistent.Country;
import common.entities.persistent.Director;
import common.entities.persistent.Genre;
import common.entities.persistent.Movie;


/**
 * @author Yoyo
 *
 */
public interface IManageMovies {

	/**
	 * Create/Update/Deletes a  movie
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Boolean value 'true'
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 */
	void actionMovie(ACTION action, Movie movie, int requestId);
	
	
	/**
	 * Counts how many movie records in the DB match wanted query
	 * 
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Integer value holding number of records
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param titleSubStr - null if not used, otherwise some string
	 * @param releaseYearMin - -1 if not used, otherwise a year
	 * @param releaseYearMax- -1 if not used, otherwise a year
	 * @param rankMin - -1.0F if not used, otherwise a rank
	 * @param rankMax -1.0F if not used, otherwise a rank
	 * @param actor - null if not used, otherwise an actor
	 * @param director - null if not used, otherwise a director
	 * @param genres - null if not used, otherwise a list of genres
	 * @param countries - null if not used, otherwise a country
	 */
	void countMovies(String titleSubStr, int releaseYearMin, int releaseYearMax, float rankMin, float rankMax,
			Actor actor, Director director, List<Genre> genres, Country country, int requestId);
	
	/**
	 * Gets the set of movies from DB that match wanted query ordered by movie title
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with List<Movie> that match wanted query  (no matches is counted as success - empty list)
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param titleSubStr - null if not used, otherwise some string
	 * @param releaseYearMin - -1 if not used, otherwise a year
	 * @param releaseYearMax- -1 if not used, otherwise a year
	 * @param rankMin - -1.0F if not used, otherwise a rank
	 * @param rankMax -1.0F if not used, otherwise a rank
	 * @param actor - null if not used, otherwise an actor
	 * @param director - null if not used, otherwise a director
	 * @param genres - null if not used, otherwise a list of genres
	 * @param countries - null if not used, otherwise a country
	 * @param from - starting from 0, 
	 * @param to - not including! (the item at 'to' index);
	 * 
	 */
	void getMovies(String titleSubStr, int releaseYearMin, int releaseYearMax, float rankMin, float rankMax,
			Actor actor, Director director, List<Genre> genres, Country country, 
			int from, int to, int requestId);
	
	/**
	 * Gets the set of actors/directors/genres from DB
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with List<Actor> that match wanted query  (no matches is counted as success - empty list)
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param movie
	 * @param from
	 * @param to
	 * 
	 */

	void getMovieEntities(Movie movie,ENTITIES entity, int from, int to,int requestId);
	
	/**
	 * creates/updates/deleted entity in movie
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Boolean value 'true'
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param movie
	 * @param actor
	 * 
	 */
	void actionEntityFromMovie(ACTION action, Movie movie, ENTITIES entity, int entityId, int requestId);

}
